package com.eorchis.module.preauthorizationregistration.ui.commond;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.apache.commons.beanutils.BeanUtils;
import org.codehaus.jackson.map.ObjectMapper;

import com.eorchis.core.page.commond.SortInfoBean;
import com.eorchis.core.ui.commond.IQueryCommond;
import com.eorchis.core.ui.commond.impl.BasePageQueryCommond;

/**
 * Title: PreAuthorizationRegistrationCommond<br>
 * Description: 个人报名预授权Commond<br>
 * Company: GoldGov<br>
 * Copyright @ 2012 GoldGov .All rights reserved.<br>
 * @author Administrator
 * @createDate 2015-01-06
 * @version $Revision$
 */
public class PreAuthorizationRegistrationQueryCommond extends BasePageQueryCommond implements IQueryCommond {

	private String[] searchIds;	
	private String searchUserId;// 用户id
	private Integer searchYear;// 年份
	private String searchDeptId;//部门id
	private List<String> searchLoginIds;//用户登陆Ids
	private Integer sqUserNum;//已授权人数
	private Integer syUserNum;//剩余人数
	private String [] searchUserIds;//用户id组
	private String searchClassId;//班级 id 
	
	public String[] getSearchUserIds() {
		return searchUserIds;
	}
	public void setSearchUserIds(String[] searchUserIds) {
		this.searchUserIds = searchUserIds;
	}
	public Integer getSqUserNum() {
		return sqUserNum;
	}
	public void setSqUserNum(Integer sqUserNum) {
		this.sqUserNum = sqUserNum;
	}
	public Integer getSyUserNum() {
		return syUserNum;
	}
	public void setSyUserNum(Integer syUserNum) {
		this.syUserNum = syUserNum;
	}
	public String getSearchDeptId() {
		return searchDeptId;
	}
	public void setSearchDeptId(String searchDeptId) {
		this.searchDeptId = searchDeptId;
	}
	public Integer getSearchYear() {
		return searchYear;
	}
	public void setSearchYear(Integer searchYear) {
		this.searchYear = searchYear;
	}
	public String[] getSearchIds() {
		return searchIds;
	}
	public void setSearchIds(String[] searchIds) {
		this.searchIds = searchIds;
	}
	public String getSearchUserId() {
		return searchUserId;
	}
	public void setSearchUserId(String searchUserId) {
		this.searchUserId = searchUserId;
	}
	public List<String> getSearchLoginIds() {
		return searchLoginIds;
	}
	public void setSearchLoginIds(List<String> searchLoginIds) {
		this.searchLoginIds = searchLoginIds;
	}
	
	/**
	 * EXT 页面排序
	 */
	private SortInfoBean sortInfo = null;
	/**
	 * 获取排序内容
	 * 
	 * @return
	 * @author HuangS
	 * @date Jul 20, 2012
	 */
	@SuppressWarnings("unchecked")
	public SortInfoBean getSortInfos() {
		return this.sortInfo;
	}

	public String getSearchClassId() {
		return searchClassId;
	}
	public void setSearchClassId(String searchClassId) {
		this.searchClassId = searchClassId;
	}
	/**
	 * 设置排序内容
	 * 
	 * @param sort
	 * @author HuangS
	 * @date Jul 25, 2012
	 */
	@SuppressWarnings("unchecked")
	public void setSort(String sort) {
		if (sort != null && !"".equals(sort)) {
			sortInfo = new SortInfoBean();
			ObjectMapper objectMapper = new ObjectMapper();
			try {
				List<LinkedHashMap<String, Object>> list = objectMapper.readValue(sort, List.class);
				for (int i = 0; i < list.size(); i++) {
					Map<String, Object> map = list.get(i);
					Set<String> set = map.keySet();
					for (Iterator<String> it = set.iterator(); it.hasNext();) {
						String key = it.next();
						BeanUtils.setProperty(sortInfo, key, map.get(key));
					}
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}
}
